#include <pthread.h>
#include <stdio.h>

void *thread1_run(void *args)
{

    while (1)
    {
        printf("thread1: %d\n", getpid());

        sleep(1);
    }
    return NULL;
}

int main()
{
    printf("进程 pid:%d\n", getpid());
    pthread_t tid;
    pthread_create(&tid, NULL, thread1_run, (void *)"thread1");

    while (1)
    {
        printf("main thread pid: %d\n", getpid());
        sleep(1);
    }

    return 0;
}